home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / FlyPaper.sit / Fly Paper / FlyPaper Source / New Sources / ClippingFolder.cpp < prev    next >
Text File  |  1996-06-22  |  2KB  |  77 lines

  1. #if 0
  2.  
  3. #ifndef CLIPPINGFOLDER_H
  4. #include "ClippingFolder.h"
  5. #endif
  6.  
  7. CClippingFolder::CClippingFolder ()
  8. {
  9. }
  10.  
  11. CClippingFolder::~CClippingFolder ()
  12. {
  13. }
  14.  
  15. void CClippingFolder::CheckForNewClippings ()
  16. {
  17.     static unsigned long    nextCheck = 0;
  18.     static unsigned long    folderModDate = 0;
  19.     
  20.     CInfoPBRec                pb;
  21.     Str255                    name;
  22.     long                    dirID;
  23.     
  24.     if (TickCount () < nextCheck)
  25.         return;
  26.     
  27.     nextCheck = TickCount () + kWatchFolderDelay;
  28.     
  29.     OSErr                    error = FlyPaperFindFolder (kOnSystemDisk, kClippingsFolder, true, &pb.hFileInfo.ioVRefNum,
  30.                                 &dirID);
  31.     if (error)
  32.         return;
  33.     
  34.     pb.hFileInfo.ioNamePtr = name;
  35.     pb.hFileInfo.ioFDirIndex = -1;
  36.     pb.hFileInfo.ioDirID = dirID;
  37.     error = PBGetCatInfoSync (&pb);
  38.     if (error)
  39.         return;
  40.     
  41.     if (pb.dirInfo.ioDrMdDat != folderModDate) {
  42.         folderModDate = pb.dirInfo.ioDrMdDat;
  43.         for (pb.hFileInfo.ioFDirIndex = 1; ; ++pb.hFileInfo.ioFDirIndex) {
  44.             
  45.             pb.hFileInfo.ioDirID = dirID;
  46.             if (PBGetCatInfoSync (&pb))
  47.                 break;
  48.             
  49.             if (pb.hFileInfo.ioFlFndrInfo.fdType != kClippingFileType)
  50.                 continue;
  51.                         
  52.             CClippingFile*            file =;
  53.             
  54.             
  55.             if (index < 0) {
  56.                 FlyPaperAuxDataHandle        auxData;
  57.                 
  58.                 if (GetClippingFileAuxData (id, auxData))
  59.                     return;
  60.                     
  61.                 clipping.clippingID = id;
  62.                 clipping.thumbnail = CThumbnail::NewThumbnail (id);
  63.                 if (clipping.thumbnail)
  64.                     clipping.thumbnail -> GetWindowBounds (clipping.windowBounds);
  65.                 else
  66.                     SetRect (&clipping.windowBounds, 0, 0, 40, 20);
  67.                 CalcWindowPosition ((**auxData).dropSpot, clipping.windowBounds, 0, clipping.onLeft);
  68.                 clipping.window = nil;
  69.                 DisposeHandle ((Handle) auxData);
  70.                 AppendClipping (clipping);
  71.             }
  72.         }
  73.     }
  74. }
  75.  
  76. #endif
  77.